package lc.q350_400;

public class Q371 {

    public int getSum(int a, int b) {
        // 不能使用加法减法，如何采用门电路方式
        while (b != 0) {
            int carry = (a & b) << 1;
            a = a ^ b;
            b =  carry;
        }
        return a;
    }

    public static void main(String[] args) {
        Q371 q371 = new Q371();
        System.out.println(q371.getSum(10,-20));
    }
}
